home *** CD-ROM | disk | FTP | other *** search
-
- ΓòÉΓòÉΓòÉ 1. Color Utility Add on ΓòÉΓòÉΓòÉ
-
- The functions contained in this DLL are designed to work with the JView imaging
- system. You will need to reference JView's main help file or the written
- manual that comes with JView for help on controls that are common to all JView
- dialogs, such as the colorwell. This particular module is provided by:
-
- Crunch Products
- P.O. Box 392
- Berkeley, CA 94701-0392
- USA
-
-
- ΓòÉΓòÉΓòÉ 1.1. Common Controls ΓòÉΓòÉΓòÉ
-
- All functions provided in the colors utility will have some of the following
- controls. For our purposes a control is considered to be a push button, a
- slider, a checkbox, etc. Their use is fairly straightforward but a detailed
- explanation is provided here.
-
- Low Priority This checkbox is a signal to run the current operations using a
- low priority thread. A basic understanding of how OS/2 works is needed here.
- OS/2 is multi-threaded, that is it allows multiple operations to occur
- simultaneously. So for instance, you may have your word processor doing a
- spell check at the same time as you are converting a color image to black and
- white. Well, OS/2 doesn't really run both applications at exactly the same
- time, rather it spends a few thousandths of a second running one program and
- then switches to the other for a few thousandths. Because we are talking about
- such small amounts of time, it appears as if both programs are running
- simultaneously. What the low priority option does is allow you to say "hey,
- run the other program more often than you run this one." It will make the
- other program (and that other program could be you doing a file listing) much
- snappier. You can change the priority even while the process is running, if
- you change your mind about which program you are most interested in.
- Something to beware is that sometimes DOS (or Windows) programs are such hogs
- that if you specify low priority, this program will run so slowly as to be
- unbearable. In those instances simply turn low priority off. Feel free to
- play, you can do not harm.
-
- Done This button indicates that you are satisfied with the current state of
- the image and are done using the current function.
-
- Cancel. This button will have two different effects depending upon whether you
- are currently applying the function. If you are testing the function, hitting
- cancel will abort that current test and return the image back to the state it
- was in before the test was started. If no test is being run, Cancel will
- return the image back to the state it was in before the current function was
- run at all. The function will also close.
-
- Undo This button will bring up the Undo Dialog. This will allow you to
- reverse changes you have made to the image.
-
- Test This button will apply the current function to the image. It can be
- undone by either using the Undo button or the Reset button.
-
- Reset The button will cause the image to revert to its most recent prior
- state. Beware that the current image state will be lost forever. This control
- can be applied multiple times until only the last level of undo is reached.
- This control is very similar to the Undo control, but it always goes back one
- level. It is most often used when you have mangled the image and know for sure
- that you do not want to keep the changes.
-
- Image This will switch focus to the image window and away from the current
- dialog.
-
- Real Time Preview This control is only provided on some functions. Basically,
- it will popup a small copy of the current image in the upper left corner of the
- screen. As adjust other controls, the effects of those changes will be shown,
- real time, on the sample image.
-
- In addition to these controls, the image window will still have access to a
- popup menu that is accessed via the right mouse button. The commands presented
- in that popup menu will vary, but are straightforward.
-
- It is very important to realize that virtually all the function provided in
- this utility pack can be applied on parts of the image as well as the entire
- image. Simply select that portion of the image you are interested in by using
- the left mouse button (with the appropriate selection method - box, ellipse,
- freehand). You can also invert the selection region, so that everything but
- the parts inside the bounding area will be affected.
-
-
- ΓòÉΓòÉΓòÉ 1.2. Adjust (Colors) ΓòÉΓòÉΓòÉ
-
- This function allows the users to adjust the image's colors in a variety of
- different colorspaces.
-
- RGB colorspace represents the image as being made up of pixels that each share
- a red component (R), green component (G), and a blue component (B). Each
- component can have a value ranging from 0-255. By moving the appropriate
- slider, the component for all pixels selected will be adjusted by the indicated
- amount. For instance, if the blue slider is set to -25, then the blue
- component (or channel) will be reduced by 25 to a minimum of 0. A value of 0
- would mean that the pixel will have no blue. The RGB option also allows the
- user to choose to manipulate only a portion of the image's tones. The low
- tones are the darker colors, while high is lighter. So if you only want to add
- a red tint to the clouds of an image that is otherwise dark, choose the High
- radio button before moving the sliders. Note The real time display option will
- always show changes as if the entire image is being changed and as if all tones
- are being changed.
-
- HSV stands for Hue, Saturation, and Value. It is often called the HSB
- colorspace, where B stands for Brightness instead of Value. This colorspace
- can be thought of as a deformed version of the RGB colorspace. Now, the RGB
- colorspace is represented by a cube, with each channel represented by a
- different orthogonal axis. The HSV colorspace can be visualized as a cone,
- except the base is hexagonal instead of circular. The center of the base
- corresponds to white, while the top of the cone is black.
-
- HLS This colorspace is very similar to the HSV colorspace. It stands for Hue,
- Lightness and Saturation. Whereas HSV is a hexagonal cone, HLS is two
- hexagonal cones with their bases back to back
-
- Luv This is the brother of the more commonly known Lab colorspace. Since Lab
- is not designed for use with electronic displays, Luv is used instead. Luv
- (Lightness, a red-green content, and a yellow-blue content parameter) is
- considered by some to be a more accurate method of representing colors. The
- main advantage of Luv over HSV type colorspaces is that the three axis of
- interest are truly independent which makes it possible to specify a luminance
- that is held constant while hue or saturation are changing.
-
- CMY The colorspace is also referred to as CMYK. It is the complement of the
- RGB colorspace, except now the axes are Cyan (C), Magenta (M), and Yellow (Y).
- Whereas RGB is typically used to specify colors that are displayed on an
- electronic display, CMY is more often used to specify colors for printing. The
- colors are additive such that when all three components are at their maximum
- (255), the resulting color is black, while the 0, 0, 0 point represents white.
-
-
- ΓòÉΓòÉΓòÉ 1.3. Black and White ΓòÉΓòÉΓòÉ
-
- The first thing you notice with the black and white dialog is the curve on the
- top of the dialog. When an image is converted to black and white (B&W), it is
- first converted to grayscale. The curve is used to modify how the colors get
- mapped to grayscale. There are 255 possible levels of gray and any given value
- of color (RGB) can be mapped to a given level of gray. This curve shifts how
- that mapping occurs. By pulling the curve down, colors that would normally map
- to light levels of gray, get shifted to darker levels. The reason for doing
- this is that you will often achieve more aesthetic images by having a slightly
- S shaped curve. You may use the right mouse button to change the type of curve
- being used while the left mouse button can be used to move the curve's control
- points.
-
- There are several methods presented for doing the actual conversion to B&W.
-
- Floyd Steinberg Dither This is one of the most popular dithers and was
- developed by R.W. Floyd and L. Steinberg. It uses an error diffusion approach.
- If you are familiar with error diffusion notation, it is represented as
-
- X 7
- 3 5 1
- Of the error diffusion methods available, it is the fastest.
-
- Stucki Dither This is another error diffusion method, in this case one assumes
- it was developed by someone named Stucki. It is represented as
-
- X 8 4
- 2 4 8 4 2
- 1 2 4 2 1
- As you can see, it is larger than the Floyd Steinberg dither. It takes more
- time to run, but in many cases will provide superior results. The definition
- of superior is troublesome when applied here because what we are really
- interested in is aesthetics. So, it technically dithers better than FS, but
- may not be aesthetically more pleasing.
-
- Stevens and Arce Dither This one is the king coconut of error diffusion. See
- the note about aesthetics above, but if you subscribe to the bigger is better
- attitude, this one's for you. It is represented as
-
- X 32
- 12 26 30 16
- 12 26 12
- 5 12 12 5
-
- Threshold Quite simply, this one makes the pixel black if it's grayscale value
- (see the first paragraph) is below the indicated threshold value, and white if
- it is above it. No one is quite sure what happens if the grayscale value is
- exactly equal to the threshold value. Some say that such a situation can't
- occur, that it is an aberration against the natural order of the universe.
- Others claim to have observed just such a situation under laboratory
- conditions, but the experiments have been impossible to verify because they
- depend on the use of a Tokamak and three dozen Cornish game hens.
-
-
- ΓòÉΓòÉΓòÉ 1.4. Borders ΓòÉΓòÉΓòÉ
-
- This is one of the few functions where the entire image must be used. Use the
- colorwell (double click) to choose an appropriate background color. Enter the
- amount of padding for each side by entering the amount in the appropriate spin
- field. Alternatively, check the Equal Sides checkbox, and all sides will be
- based on the value indicated in the Left spin field.
-
- The four buttons (640 X 480, etc.) represent screen dimensions and by pushing
- on one, the padding needed to fill such a screen is automatically calculated.
-
-
- ΓòÉΓòÉΓòÉ 1.5. Contrast ΓòÉΓòÉΓòÉ
-
- Contrast refers to the difference in extremes of colors a given image uses. By
- increasing the contrast, an image can appear more vibrant and details can
- become more visible. Imagine you image is composed of three colors, all gray
- that are very similar in intensity. By increasing the contrast, the lowest
- intensity gray would be made darker, while the lightest gray would be made even
- lighter. The result is that each color is more distinguishable. The opposite
- effect is also possible.
-
- The downside of contrast enhancement is that once colors reach a limit in terms
- of brightness, they can begin to do a color shift. For example, image the
- color being adjusted starts out with an RGB point of 128, 255, 255. This means
- that it already has maximum green and blue. To increase this color's contrast
- the only possible option is to increase red, but this serves to make the color
- whiter.
-
- The contrast slider has a range of -128 to 128. The scale is not too
- important, you will do better to play with values to achieve the desired
- effect.
-
- Instead of the setting a contrast value, you may choose to let the application
- attempt to Auto Enhance the image. This algorithm works by computing a
- histogram (a record of how many times each color is used) of the image and then
- forcing the percentage of the image indicated towards black and also the other
- amount indicated to white. The higher the percentages indicated, the greater
- the contrast that will be acheived, but the cost will be the potential color
- shift mentioned above.
-
-
- ΓòÉΓòÉΓòÉ 1.6. Edit Palette ΓòÉΓòÉΓòÉ
-
- This function is only applicable for images that have 256 or fewer colors. If
- your image is 24 bit, you must first reduce it to 8 bit.
-
- Basically, just double click on the color you are interested in changing. This
- will bring up the colorwheel so that you may indicate the desired changes. The
- changes will take place over the entire image, not just a selected area. The
- palette does support dragging and dropping of colors from the colorwheel or
- other palettes.
-
- Swap and Copy are used to indicate what will occur when colors within the
- displayed palette are dragged and dropped. If Swap is selected, then the color
- that is picked up will be swapped with the color the is dropped onto. Copy
- will cause the color that is dropped onto to become the color that was dropped.
-
- Find Color will bring up a magnification window in the upper left corner of the
- screen. Simply position the cursor over the color you are interested in
- finding and hit the right mouse button. The color can be anywhere on the
- screen. If no exact match can be found, the closest color is used.
-
- There is a slim button at the top of the palette control. Push it to bring up
- different ways of sorting the displayed colors. If it wasn't obvious, use the
- right mouse button to drag and drop colors. Note the colors display may be
- only approximations if your system is only running at 8 bits.
-
-
- ΓòÉΓòÉΓòÉ 1.7. Gamma ΓòÉΓòÉΓòÉ
-
- Ideally an electronic display will linear for luminance with respect to
- voltage. For many Apple Macs, this is the case, but for most PCs, it is not.
- The result of this is that an image displayed on one screen, may look murky on
- another. So, gamma correction simply alters how an image's luminances are
- actually displayed. In theory, the correction factor can vary depending on age
- of the monitor, weather, etc.
-
- Gamma correction is really an aesthetic question, it is best to just try
- different values. Greater than one will brighten the image, less than one will
- darken it.
-
-
- ΓòÉΓòÉΓòÉ 1.8. Grayscale ΓòÉΓòÉΓòÉ
-
- There are 255 possible levels of gray. The mapping of a given color into the
- corresponding gray level is simple. However, aesthetics are often improved by
- shifting that mapping. The S shaped curve presented at the top of this dialog
- is used to adjust the grayscale mapping. A straight line from lower left to
- upper right would mean no mapping. The S curve means that some of the dark but
- not black colors get mapped to black, and some of the light but not white
- colors get mapped to white. Use the right mouse button to choose the type of
- curve, and the left mouse button to adjust the curves control points.
-
- You may choose how many levels of gray to provide by selecting the appropriate
- radio button.
-
-
- ΓòÉΓòÉΓòÉ 1.9. Histogram ΓòÉΓòÉΓòÉ
-
- This function shows the user the histogram of the current image. A histogram
- is a calculation of how many pixels of the image are a given intensity. Or
- more simply, how many times is a given color used. The figure at the top of
- the dialog is a qualitative display of how often different colors are used. A
- single line would mean that only one level of gray is used. It is in terms of
- gray because we are interested in intensities, not true colors. Histogram
- equalization can be applied to your image, but the image will be reduced to
- grayscale. This equalization (which occurs when AHE is selected) attempts to
- spread out the use of colors. To a certain degree, this is similar to contrast
- enhancement.
-
- The AHE checkbox represents the use of tradition histogram equalization
- techniques. The user can elect to preserve the maximum and minimum values the
- image possesses or allow them to be mapped to 255 and 0 respectively for
- greater contrast.
-
- Alternatively, the user can use a clip limit in conjunction with regions to
- perform Contrast Limited Adaptive Histogram Equalization, as described in
- "Graphics Gems IV", Academic Press, 1994. This will be used when AHE is not
- checked. Basically the image is broken into regions and histogram equalization
- is performed on each individual region. The effects can be quite profound in
- bringing out lost details. Try a large number of regions and a high clip limit
- (20,000).
-
-
- ΓòÉΓòÉΓòÉ 1.10. Invert ΓòÉΓòÉΓòÉ
-
- Not too many options here! Inversion is quite simple. A given colors is
- represented by its three color components, Red, Green, and Blue. These
- components have levels that range 0-255. Inversion takes the component level
- and subtracts it from 255 (mathematically red = 255 - red). The result is the
- inverse of the image or for you photographers out there you get the
- photographic negative.
-
-
- ΓòÉΓòÉΓòÉ 1.11. Reduce ΓòÉΓòÉΓòÉ
-
- This dialog is used to reduce the number of colors that the current image is
- using.
-
- Count will count the number of colors currently in use. On a 24 bit image the
- count will give up when the number of unique colors exceeds 65536. On 8 bit
- images it will calculate the number of unique colors, not just the number of
- colors in separate channels. What does this mean. Well, your image might
- think it has 234 different colors (an example number). But in reality, it has
- one color that is white and 233 colors which are all the same - say black.
- Counting will actually compare the colors used and detect when the image has
- duplicates.
-
- If the current image is 24 bit, it can be reduced to either 16, 15, or 8 bit.
- As far as OS/2 goes, there are only 24 bit and 8 bit images so there is no
- memory saving for going to 15/16 bit. It is useful to go to those color depths
- if the image is not displaying well at 24 bit. This may occur if your system
- is set up to display at 15 or 16 bit. When going to 15/16 bit either an Error
- Diffusion method or Jitter method can be used. With the jitter method a noise
- level is also specified. The higher levels of noise will break up banding more
- but will also begin to degrade the image.
-
- When going to 8 bit, color mapping can be achieved by going to the most used
- colors (which is the most conventional way) or by collapsing the colors used by
- combining those which are closest together (nearest color). When most used
- colors is selected, you can optionally apply error diffusion (Floyd Steinberg).
- With 8 bit mapping, you can specify the actual number of colors used, not just
- the color depth.
-
-
- ΓòÉΓòÉΓòÉ 1.12. Remap ΓòÉΓòÉΓòÉ
-
- Remapping is one of the most versatile operations that can be performed. It
- allows the ability to do very controlled contrast manipulations as well as
- color inversions.
-
- All changes are input through the curve control. You may operate on all three
- color channels at once or allow them to be adjusted independently (it uses RGB
- color space). When you have selected the R (red) channel, the other channels
- will still be applied as displayed, however you will not be able to change
- them. This is so that you can easily manipulate a particular channel and still
- have the others displayed.
-
- The curve control should be thought of as representing two axis. The vertical
- axis is where the value indicated on the horizontal axis will be mapped to.
- Each axis ranges from 0 to 255, which corresponds to the range of the RGB
- colorspace. For example, a straight line going from the lower left corner (the
- origin at 0, 0) through the upper right corner (255, 255) can be mathematically
- represented by the curve x = y. What this means is that a value of 45 for red,
- would be converted to a value of 45 - in other words there would be no change.
- If instead of the line x = y, we had a horizontal line starting at the origin,
- its equation would be y = 0. Then our value of 45 for red, would now be
- converted to 0. Such a curve would map the whole image to black. Sound
- confusing? You bet! Well, just play with it for a few minutes and you'll see
- what's happening. Don't forget to use the right mouse button to change the
- types of curves available.
-
- The dialog allows the use of real time changes display.
-
-
- ΓòÉΓòÉΓòÉ 1.13. Swap Palette ΓòÉΓòÉΓòÉ
-
- Swap palettes will display two palettes. The current palette (on the left) and
- the palette that will be used instead. This dialog can only be used on 8 bit
- images.
-
- The current palette cannot be edited, but the new palette can be edited just as
- described in the Edit Palette section. Although you cannot edit he current
- palette, you can reorder the display of colors.
-
- The colors of the current palette and new palette are swapped position for
- position. Thus, the color displayed in the upper left hand corner of the
- current palette will become the color displayed in the upper left hand corner
- of the new palette.
-
- The list box in the lower right corner of the dialog contains several built in
- palettes that the user may find interesting. Two of them may seem confusing.
- 7R 8G 4B is the standard palette used on the 8514 video card. 7R means it has
- 7 levels of Red, 8G means 8 level so green, etc. 6R 6G 6B follows a similar
- convention. Fire is just a cool palette, try it with your original palette
- expanded and sorted by intensity.
-
- The Load and Save buttons allow you to store and retrieve palettes.
-
- Add allows you to add a new color to the new palette, assuming it contains less
- than 256 colors.
-
- Find will show you where a particular color is on your current palette. Use
- the right mouse button, with the help of the magnified display that will appear
- in the upper left hand corner of the screen, to indicate the color of interest.
-
- Expand is used when your current palette is less than 256 colors. Expand will
- attempt to fill in spaces in the color table so that it appears as if your
- current palette is 256 colors. This is used so as to minimize the amount of
- positioning needed to align palettes of different sizes.
-
- Note about 8 bit systems. An 8 bit system means you can only display 256
- unique colors at a given time. Yet, this very function means that your are
- likely trying to display upwards of 500 different colors at the same time.
- Something has to give. Either the colors will not be represented in their true
- state, or a certain amount of mapping will occur depending on which control has
- the focus. There is no cure for this except for upgrading to a 15 bit or
- higher video system
-
-
- ΓòÉΓòÉΓòÉ 1.14. System Colors ΓòÉΓòÉΓòÉ
-
- Convert the image to display using the 8 bit system palette. If error diffusion
- is selected, Floyd Steinberg error diffusion is used, otherwise colors are
- mapped to the closest system color.
-
- Having images in the system colors is useful when multiple images are to be
- displayed on an 8 bit system. Further, when creating background or lockup
- images, system colors give the most pleasing results.
-
- In order to use the error diffusion, you will have had to have created the
- Jview.dth file. To create this file, close the System Colors dialog. Bring up
- the popup menu with the right mouse button and look under Misc. for the create
- JView.dth command. Follow its instructions.
-
-
- ΓòÉΓòÉΓòÉ 1.15. Tones ΓòÉΓòÉΓòÉ
-
- This is really one of the cooler functions once you get the hang of it. A
- little background about printing. You start with white paper and then add a
- drop of color to it - lets say that drop has equal parts of red, green and
- blue. That first drop will look really pale, because there isn't too much ink
- and the light can penetrate the ink and gets reflected off the white paper
- without too much loss of energy. Now add a second drop, right on top of the
- first. The point has gotten darker, because the light can't penetrate as
- easily. Keep adding drops and the point turns black. Now, once that point is
- black, it doesn't matter if you add more red, or green, or blue, it just stays
- black. Now, many printing operations only use a very limited number of ink
- colors, for now lets say one. That ink color is usually black. By varying the
- amount of ink used, (remember above) a given point will appear white (no ink),
- gray (some ink), or black (lots of ink). In this manner, you get a grayscale
- image.
-
- Now for the fun part. Why use black ink? You can do the same with a nice warm
- magenta. No ink still means white, but were gonna cheat and say lots of ink is
- just solid magenta. This is a monotone image. In our case you use the
- colorwell to indicate the type of ink you want, and the curve window indicates
- how the ink gets added. The x, or horizontal axis, represents what level of
- intensity on the image we are talking about (range is 0 - 255), while the
- vertical axis indicates how much ink (what level of intensity) of the color
- will appear there. So the zero point on the x axis refers to the dark parts of
- the image - 0 intensity, while the end of the x axis refers to the lightest
- parts of the image. Now the y axis may seem a little confusing. We want high
- values y to correspond to a high brightness level of the color. And high
- brightness means little ink. This contrasts to low brightness which means lots
- of ink (remember how printing works). So, if we have a really low y axis value
- (say 0) that means use all the ink you can, or make the corresponding x axis
- get solid color. A y value of 255 (the top of the axis) would mean no ink, or
- solid white.
-
- But why only use one color, lets try blending two colors. Things are a little
- trickier, but the results are worth it. Lets do a dualtone (select the
- dualtone radio button). Choose black for the first color, this will give us a
- grayscale image to start with. For now, just drag the black color in the first
- colorwell onto the second colorwell. Test the result, you will get a very dark
- image. What happened, the color is the same for both tones? Remember how
- printing works, you have effectively printed one image and then printed and
- identical image right on top of the first - you are using lots of ink. Think
- of it as printing the image multiple times, one on top of the other. You need
- to reduce the amount of ink used on each pass. Take the color control curves
- for both colors and move them up and test the image again (also remember to
- reset the image first!). Things probably look better now, if not, move the
- curves up even higher (my God, not that high!!!). Ok, pretty dull. But now
- change the color in the second colorwell to a new color, try a magenta-like
- color. You can add warmth to a grayscale image this way.
-
- Just as the method outlined above applies to dualtone, so it applies to the tri
- and quad tones. Just remember that you are effectively adding more ink, the
- more tones you use and so you will have to reduce the amount of ink each tone
- adds.
-
-
- ΓòÉΓòÉΓòÉ 1.16. Transpose ΓòÉΓòÉΓòÉ
-
- This tool is used to replace a color, or range of colors with one new color.
-
- Three different colors can be entered. The colorwell in the upper left region
- is the base color, i.e. the main color to be changed. Beneath the base color is
- the optional range color. If a range color is used, then any color contained
- in the RGB colorspace existing between the base color and the range color will
- be mapped to the new color. The new color is located in the colorwell to the
- right of the base color.
-
- If no range color is indicated, the tolerance value will be used with the base
- color. A tolerance of 0 means that only colors that exactly match the base
- color will be changed. If a tolerance of 2 were to be used, then all colors
- which were with 2 units of the base color in the red, green, and blue channels
- would be replaced by the new color.
-
- Colors are input into a color well by drag/drop or by double clicking with the
- left mouse button.